<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css" href="__THEMES__/style/layout.css" />
		<script type="text/javascript" src="__JS__/jQuery/jquery.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/alertbox.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/jquery.cookie.js"></script>
		<include file="Public:js_artDialog" />
		<include file="Public:js_editor" />
		<script type="text/javascript">
			KindEditor.ready(function(K){
				var editor = K.create("#content",{
					uploadJson:'{:U("uploadfile/uploadeditor")}',
					fileManagerJson:'{:U("filemanage/viewlist")}',
					allowFileManager : true,
					sessionid : '<?php echo $_COOKIE["PHPSESSID"];?>',
					afterUpload:function(data){
						if($("#content_attachment").val() == ""){
			       			$("#content_attachment").attr("value",data);
			       		}else{
			       			$("#content_attachment").attr("value",$("#content_attachment").val()+"|"+data);
			       		}
					}
				});
			});
        	
            $(function(){
                $('#newupthumb').click(function(){
					art.dialog.open('{:U("cropZoom/index")}',{
						title : '上传裁切图片',
						width : 800,
						height : 500,
						init : function(){
							art.dialog.removeData('crop_zoom_thumb');
						},
						close : function(){
							var value = art.dialog.data('crop_zoom_thumb');// 读取B页面的数据
							if (value !== undefined && value != '') {
								document.getElementById('thumb').value = value;
								$("#thumb_pic_tr").show();
								var append = '?' + new Date().getTime() + 'a' + Math.random();
								$("#thumb_pic").attr("src",value+append);
							}
						},
						lock : true
					});
				});
				removeInputStyle('.input_text');
				$('form').submit(function(){
					if ( $.trim( $('input[name="title"]').val() ) == '' ){
						setInputStyle( 'input[name="title"]' );
						setAlertBox('标题不能为空！', 2);
						return false;
					}
					if ( $('select[name="cid"]').val() == 'pselect' ){
						setInputStyle( 'select[name="cid"]' );
						setAlertBox('请选择分类！', 2);
						return false;
					}
				});
            });
		</script>
		<style type="text/css">
			table td		{ border:0; padding:7px 5px; }
		</style>
	</head>
	<body>
		<include file="Public:position" />
		
        <div class="a_table">
	    	<form action="__URL__/insert" method="post">
			<input type="hidden" name="content_attachment" id="content_attachment" value="" />
			<input type="hidden" name="type" value="article" />
			<table cellspacing="1" width="100%" class="form_table">
				<tr>
					<td align="right" width="100"></td>
					<td align="left"></td>
				</tr>
				<tr>
					<td align="right" width="100">文章标题</td>
					<td align="left"><input type="text" name="title" class="input_text w480" /></td>
				</tr>
				<tr>
					<td align="right">分类</td>
					<td align="left">
						<select name="cid" class="input_text" style="width:auto; font-family: Verdana;">
							<option value="pselect">请选择分类</option>
							{$option}
						</select>
					</td>
				</tr>
				<tr>
					<td align="right">文章属性</td>
					<td align="left">
						<input type="checkbox" name="set_top" value="1" /> 置顶 &nbsp;&nbsp;
						<input type="checkbox" name="recommend" value="1" /> 推荐 &nbsp;&nbsp;
					</td>
				</tr>
				<tr>
					<td align="right">标签</td>
					<td align="left"><input type="text" name="tags" class="input_text w480" /> 多个用空格分割</td>
				</tr>
				<tr>
					<td align="right">状态</td>
					<td align="left">
						<input type="radio" name="status" value="1" checked="checked" /> 显示 &nbsp;&nbsp;
						<input type="radio" name="status" value="0" /> 隐藏 &nbsp;&nbsp;
					</td>
				</tr>
				<tr>
					<td align="right">缩略图</td>
					<td align="left">
						<input type="text" name="thumb" id="thumb" value="" class="input_text w480" style="float:left;margin:0;" align="absmiddle" /> 
						<input type="button" id="newupthumb" class="submit" value="上传缩略图" style="float:left;margin-left: 10px;" /><span style="margin-left: 10px;"> *(此功能可自定义大小再次裁切。)</span>
					</td>
				</tr>
				<tr id="thumb_pic_tr" style="display:none;">
					<td align="right">&nbsp;</td>
					<td align="left"><img src="" id="thumb_pic" /></td>
				</tr>
				<tr id="chk_summary">
					<td align="right">摘要设置</td>
					<td align="left">
						<input type="radio" name="select_summary" id="auto_summary" value="auto" checked="checked" /> 自动生成&nbsp; 
						<input type="radio" name="select_summary" id="custom_summary" value="custom" /> 自定义
					</td>
				</tr>
				<tr>
					<td align="right">文章内容</td>
					<td align="left"><textarea name="content" id="content" style="width: 90%; height:260px;"></textarea></td>
				</tr>
				<tr>
					<td align="right"></td>
					<td align="left"><input type="submit" class="submit" value="提交表单" /></td>
				</tr>
				<tr>
					<td align="right" width="100"></td>
					<td align="left"></td>
				</tr>
			</table>
			</form>
        </div>
	</body>
</html>